﻿@using System.Collections.Generic;
@using Think.Lenovo.Com.Common;
@using Think.Lenovo.Com.Models;
@using Think.Lenovo.Com.Models.Users;
@using System.Web.Mvc;
@using System.Web.Mvc.Html;
<html>
<link href="/Contents/css/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="no" />
<link rel="stylesheet" type="text/css" href="/Contents/resources/css/reset.css" />
<link rel="stylesheet" type="text/css" href="/Contents/resources/css/style.css" media="screen" />
<link id="color" rel="stylesheet" type="text/css" href="/Contents/resources/css/colors/blue.css" />
<script type="text/javascript" src="/Scripts/lib/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/Scripts/lib/SerializeObject.js"></script>
<script type="text/javascript" src="/Scripts/ViewManageUser.js"></script>
<body>
    <div id="content" style="background: url(/Contents/resources/images/background.png);">
        <!-- content / right -->
        <div id="right">
            <!-- table -->
            <div class="box">
                <!-- box / title -->
                <div class="title">
                    <h5>
                        用户管理</h5>
                </div>
                <div class="table">
                    <table>
                        <tr>
                            <td>
                                用户名
                            </td>
                            <td>
                                <input type="text" id="UserName" maxlength="50" size="15" />
                            </td>
                            <td>
                                密码
                            </td>
                            <td>
                                <input type="password" id="UserPassword" maxlength="16" size="15" />
                            </td>
                            <td>
                                角色
                            </td>
                            <td>
                                @{   
                                    Dictionary<String, Object> attributes = new Dictionary<string, object>();
                                    attributes.Add("onchange", "getRoleLevels(this)");
                                    @System.Web.Mvc.Html.SelectExtensions.DropDownList(this.Html, "UserRole", (List<System.Web.Mvc.SelectListItem>)ViewData["UserRole"], attributes);
                                }
                                等级:
                                <select id="UserLevelId" style="width: auto;">
                                    <option value="">- 请选择 - </option>
                                </select>
                                <!-- 用户状态 -->
                                <input type="hidden" id="UserState" value="2" />
                            </td>
                            <td>
                                <input type="button" name="" value="保存用户" onclick="SaveUser();" />
                                <input type="hidden" id="Id" value="undefined" />
                                <input type="button" id="CancelEditBtn" value="取消修改" onclick="reset();" disabled="disabled" />
                            </td>
                        </tr>
                    </table>
                    <div>
                    <input type="button" value="批量删除" onclick="operateUsers('3');" />
                    <input type="button" value=" 批量开启" onclick="operateUsers('1');"  />
                    <input type="button" value="批量锁定" onclick="operateUsers('2');"  />
                    </div>
                    <hr />
                    
                    <table id="userList" style="table-layout: auto;" width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <td align="center">
                                <font color='green'>用户Id</font>
                            </td>
                            <td align="center">
                                <font color='green'>用户名</font>
                            </td>
                            <td>
                                <font color='green'>真实姓名</font>
                            </td>
                            <td align="center">
                                <font color='green'>所属角色</font>
                            </td>
                            <td align="center">
                                <font color='green'>用户等级</font>
                            </td>
                            <td align="center">
                                <font color='green'>用户状态</font>
                            </td>
                            <td align="center">
                                <font color='green'>操作</font>
                            </td>
                        </tr>
                        @{
                            foreach (ViewUserModel u in (LinkedList<ViewUserModel>)ViewData["list"])
                            {
                            <tr>
                                <td align="center">
                                <input type="checkbox" value="@u.Id" name="userId" />
                                </td>
                                <td align="center">@u.UserName
                                </td>
                                <td align="center">@u.RealName
                                </td>
                                <td align="center">@u.UserRoleName
                                </td>
                                <td align="center">@u.UserLevelName
                                </td>
                                <td align="center">@u.UserStateName
                                </td>
                                <td align="center">
                                    <a href="#" onclick="setState(@u.Id,1);">开启</a> | <a href="#" onclick="setState(@u.Id,2);">
                                        锁定</a> | <a href="#" onclick="setState(@u.Id,3);">删除</a> | <a href="#" onclick="bindData(@u.Id);">
                                            修改</a> | <a href="/User/ViewEditUserInfo/@u.Id">完善用信息</a> |
                                </td>
                            </tr>
                            }
                        }
                    </table>
                    <div id="pager">
                        @{
                            foreach (PageNumberModel m in (LinkedList<PageNumberModel>)ViewData["pager"])
                            {
                                if (!m.IsCurrentPage)
                                {
                            <a href="@m.PageLink">［@m.PageNum］</a>
                                }
                                else
                                {
                            @m.PageNum
                                }
                            }
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
